﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TAdCustomerLinkman.aspx.cs" Inherits="Adcustomer_TAdCustomerLinkman" %>

<%@ Register Assembly="GMDatePicker" Namespace="GrayMatterSoft" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
         table { border-collapse:collapse; border: none; padding: 0; margin: 0; }
    </style>
    <link href="../css/ecrm03.css" rel="stylesheet" type="text/css" />
    <link href="../css/pagebox.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery0905.js" type="text/javascript"></script>
    <script src="../js/jqModal.js" type="text/javascript"></script>  
    <script language="JScript" src="../js/myCheck.js"></script>
    <script type="text/javascript" language="javascript">  
    function NotCharacter(str,name)
    {
        var vstr =/^[A-Za-z0-9]+$/;
        if(!vstr.test(str)){
        alert(name+"必须是字母或数字!");
        return false;}
    }
    function chk() 
	{
	    $('#txt_id').val($.trim( $('#txt_id').val()));
	    $('#txt_name').val($.trim( $('#txt_name').val()));
	    $('#txt_tel').val($.trim( $('#txt_tel').val()));
	    $('#txt_mobile').val($.trim( $('#txt_mobile').val()));
	    $('#txt_fax').val($.trim( $('#txt_fax').val()));
	    $('#txt_email').val($.trim( $('#txt_email').val()));
	    $('#birthday').val($.trim( $('#birthday').val()));
	    $('#txt_qq').val($.trim( $('#txt_qq').val()));
	    
	    if(NotCharacter(form1.txt_id.value,"编码")==false) return false;
		if(CheckText(form1.txt_id,"编码",30)==false) return false;
		if(CheckText(form1.txt_name,"姓名",10)==false) return false;
		if(CheckText(form1.txt_tel,"电话",30)==false) return false;
		if(CheckText(form1.txt_mobile,"手机",30)==false) return false;
		if(CheckText(form1.txt_fax,"传真",10)==false) return false;
		if(CheckText(form1.txt_email,"电子邮件",30)==false) return false;
		if(CheckText(form1.birthday,"生日",30)==false) return false;
        if(CheckText(form1.txt_qq,"MSN/QQ账户",30)==false) return false;


		return true;
	}
	function chk1()
	{
	    $('#txt_uname').val($.trim( $('#txt_uname').val()));
	    $('#txt_utel').val($.trim( $('#txt_utel').val()));
	    $('#txt_umobile').val($.trim( $('#txt_umobile').val()));
	    $('#txt_ufax').val($.trim( $('#txt_ufax').val()));
	    $('#txt_uemail').val($.trim( $('#txt_uemail').val()));
	    $('#ubirthday').val($.trim( $('#ubirthday').val()));
	    $('#txt_uqq').val($.trim( $('#txt_uqq').val()));
	
		if(CheckText(form1.txt_uname,"姓名",10)==false) return false;
		if(CheckText(form1.txt_utel,"电话",30)==false) return false;
		if(CheckText(form1.txt_umobile,"手机",30)==false) return false;
		if(CheckText(form1.txt_ufax,"传真",10)==false) return false;
		if(CheckText(form1.txt_uemail,"电子邮件",30)==false) return false;
		if(CheckText(form1.ubirthday,"生日",30)==false) return false;
        if(CheckText(form1.txt_uqq,"MSN/QQ账户",30)==false) return false;
        return true;
	}
    $(function() {
        $("#checkedAll").click(function() { 
            if ($(this).attr("checked") == true) { // 全选
                    $("input[@type='checkbox']").each(function() {
                    $(this).attr("checked", true);
                    });
                } else { // 取消全选
                    $("input[@type='checkbox']").each(function() {
                    $(this).attr("checked", false);
                });
            }
        });
    });
    
    $().ready(function() {
        $('#divInsert').jqm({modal: true,trigger: '#btn_Insert'});
        $('#divUpdate').jqm({modal: true,trigger: '#btn_update'});
//        $('#divDelete').jqm({trigger: '#delete'});
//        $('#divUpload').jqm({trigger: '#upload'});
//        $('#divCopy').jqm({trigger: '#copy'});
//        $('#divPaste').jqm({trigger: '#paste'});
//        $('#divCut').jqm({trigger: '#cut'});
//        $('#divKeyword').jqm({trigger: '#addkeyword'}); 
//        $('#divRemark').jqm({trigger:'#remark'});
    });
    function checkfile()
    {
        var ext=$('#FileUpload1').val().split(".")[$('#FileUpload1').val().split(".").length-1];
        var notstr="bat,com,exe";
        if(notstr.indexOf(ext) !=-1)
        {
            alert("不能上传可执行文件!");
            return false;
        }
        return true;
    }
    function checksel()
    {
        var count=$("input[@type='checkbox']")
    }
        function showdiv()
    {
        $('#divUpdate').jqmShow(); 
    }
    
    function edit(strid)
    {
        var urlstring="TAdCustomerLinkman.aspx";
            $.ajax({
            url:urlstring,
            type:'post',
            dataType:'html',
            data:'&opration=edit&id='+ strid ,
            beforeSend:function()
            {
               
            },
            error:function()
            {
               
            },
            success: function(msg)
            {
                var val=msg.split(',');
            
                $('#lbl_id').text(val[0]);
                $('#lbl_cid').text(val[1]);
                $('#txt_uname').val(val[2]);
//                $('#ddl_usex').text(val[3]);
                $('#txt_utel').val(val[4]);
                $('#txt_umobile').val(val[5]);
                $('#txt_ufax').val(val[6]);
                $('#txt_uemail').val(val[7]);   
                $('#txt_udeptname').val(val[8]);
                $('#txt_ujob').val(val[9]);
                $('#ubirthday').val(val[10]);
                $('#txt_uqq').val(val[11]);
                $('#HiddenField1').val(val[0]);
                $('#HiddenField3').val(val[1]);
                $('#divUpdate').jqmShow(); 
               
                
            }
            });
    }
    function showdivinsert()
    {
         $('#divInsert').jqmShow();
    }
    
      function   kk(obj)   
      {           
      if(obj.value.length==10)   
      {   
      event.keyCode   =   0;   
      return   ;   
      }   
      } 
function ddlbind()
    {
        var urlstring="TAdCustomerLinkman.aspx";
            $.ajax({
            url:urlstring,
            type:'post',
            dataType:'html',
            data:'&opration=ddlbind' ,
            beforeSend:function()
            {
               
            },
            error:function()
            {
               
            },
            success: function(msg)
            {
               
            }
            });
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <div id="menu">
            <div id="divInsert" class="jqmWindow" style="display:none; left: 54%; top: 22%; width: 337px; height: 366px; text-align: center;">
       <table width='100%' style ="background-color:#0075b0">
            <tr>
                 <td align="left" id='tdtitle' style="font-size:12px;color:White">增加</td>
                <td align="right" ><asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/adsales/images/close.png"
                    OnClick="ImageButton2_Click" /></td>
            </tr>
       </table>
       
       <table style="width: 333px; height: 307px">
            <tr>
                <td style="width: 128px; text-align: right"></td>
                <td colspan="2" style="text-align: left">
                    &nbsp;</td>
            </tr>
            <tr>
                <td style="width: 128px; text-align: right">
                    编码：</td>
                <td colspan="2" style="text-align: left">
                    <asp:TextBox ID="txt_id" runat="server"></asp:TextBox>
                    <asp:Label ID="lab_iid" runat="server" Width="52px"></asp:Label></td>
            </tr>
            <tr>
                <td style="width: 128px; text-align: right">
                    姓名：</td>
                <td style="text-align: left" colspan="2">
                    <asp:TextBox ID="txt_name" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 128px; text-align: right; height: 24px;">
                    性别：</td>
                <td colspan="2" style="height: 24px; text-align: left">
                    <asp:DropDownList ID="ddl_sex" runat="server">
                        <asp:ListItem>男</asp:ListItem>
                        <asp:ListItem>女</asp:ListItem>
                    </asp:DropDownList></td>
            </tr>
           <tr>
               <td style="width: 128px; text-align: right">
                   电话：</td>
               <td colspan="2" rowspan="1" style="text-align: left">
                    <asp:TextBox ID="txt_tel" runat="server" Height="15px" MaxLength="10" Width="127px" Rows="2" ></asp:TextBox></td>
           </tr>
           <tr>
               <td style="width: 128px; text-align: right">
                   手机：</td>
               <td colspan="2" rowspan="1" style="text-align: left">
                   <asp:TextBox ID="txt_mobile" runat="server"></asp:TextBox></td>
           </tr>
            <tr>
                <td style="width: 128px; text-align: right">
                    传真：</td>
                <td style="text-align: left" colspan="2">
                    <asp:TextBox ID="txt_fax" runat="server"></asp:TextBox><%--<asp:RadioButton ID="rbtn_yes" runat="server" Checked="True" GroupName="2" Text="有效" />
                    <asp:RadioButton ID="rbtn_no" runat="server" GroupName="2" Text="失效" />--%></td>
            </tr>
           <tr>
               <td style="width: 128px; text-align: right">
                   电子邮件：</td>
               <td style="text-align: left" colspan="2">
                   <asp:TextBox ID="txt_email" runat="server"></asp:TextBox></td>
           </tr>
           <tr>
               <td style="width: 128px; text-align: right">
                   部门：</td>
               <td style="text-align: left" colspan="2">
                   <asp:DropDownList ID="ddl_deptname" runat="server" Width="100px">
                   </asp:DropDownList></td>
           </tr>
           <tr>
               <td style="width: 128px; text-align: right">
                   职位：</td>
               <td style="text-align: left" colspan="2">
                   <asp:DropDownList ID="ddl_jop" runat="server" Width="100px">
                   </asp:DropDownList></td>
           </tr>
           <tr>
               <td style="width: 128px; text-align: right">
                   生日：</td>
               <td style="text-align: left" colspan="2">
                   &nbsp;<cc1:GMDatePicker ID="birthday" runat="server">
                   </cc1:GMDatePicker>
               </td>
           </tr>
           <tr>
               <td style="width: 128px; text-align: right">
                   MSN/QQ账户</td>
               <td colspan="2" style="text-align: left">
                   <asp:TextBox ID="txt_qq" runat="server"></asp:TextBox></td>
           </tr>
            <tr>
                <td colspan="3" style="text-align: center">
                    <asp:Button ID="btn_insert" runat="server" Text="确定" OnClick="btn_insert_Click"  Width="50px" OnClientClick="return chk()" style="color: #ffffff; background-color: #296cb3" Height="20px"  /></td>
            </tr>
       </table>
                <asp:HiddenField ID="HiddenField2" runat="server" />
       </div>
       
       
       
        <div id="divUpdate" class="jqmWindow" style="display:none; left: 54%; top: 22%; width: 337px; height: 366px; text-align: center;">
           <table width='100%' style ="background-color:#0075b0">
                <tr>
                     <td align="left" id='td1' style="font-size:12px;color:White">修改</td>
                    <td align="right" style="width: 177px" ><asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/adsales/images/close.png"
                        OnClick="ImageButton2_Click" /></td>
                </tr>
           </table>
           
           <table style="width: 333px; height: 307px">
               <tr>
                   <td style="width: 128px; text-align: right"><br />
                   </td>
                   <td colspan="2" style="text-align: left">
                   </td>
               </tr>
                <tr>
                    <td style="width: 128px; text-align: right">编码：</td>
                    <td colspan="2" style="text-align: left">
                        <asp:Label ID="lbl_id" runat="server" Text="Label" Width="37px"></asp:Label></td>
                </tr>
                <tr>
                    <td style="width: 128px; text-align: right">
                        客户编码：</td>
                    <td colspan="2" style="text-align: left">
                        <asp:Label ID="lbl_cid" runat="server" Text="Label" Width="39px"></asp:Label></td>
                </tr>
                <tr>
                    <td style="width: 128px; text-align: right">
                        姓名：</td>
                    <td style="text-align: left" colspan="2">
                        <asp:TextBox ID="txt_uname" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td style="width: 128px; text-align: right; height: 24px;">
                        性别：</td>
                    <td colspan="2" style="height: 24px; text-align: left">
                        <asp:DropDownList ID="ddl_usex" runat="server" Width="88px">
                            <asp:ListItem>男</asp:ListItem>
                            <asp:ListItem>女</asp:ListItem>
                        </asp:DropDownList></td>
                </tr>
               <tr>
                   <td style="width: 128px; text-align: right">
                       电话：</td>
                   <td colspan="2" rowspan="1" style="text-align: left">
                        <asp:TextBox ID="txt_utel" runat="server" Height="15px" MaxLength="10" Width="127px" Rows="2" ></asp:TextBox></td>
               </tr>
               <tr>
                   <td style="width: 128px; text-align: right">
                       手机：</td>
                   <td colspan="2" rowspan="1" style="text-align: left">
                       <asp:TextBox ID="txt_umobile" runat="server"></asp:TextBox></td>
               </tr>
                <tr>
                    <td style="width: 128px; text-align: right">
                        传真：</td>
                    <td style="text-align: left" colspan="2">
                        <asp:TextBox ID="txt_ufax" runat="server"></asp:TextBox><%--<asp:RadioButton ID="rbtn_yes" runat="server" Checked="True" GroupName="2" Text="有效" />
                        <asp:RadioButton ID="rbtn_no" runat="server" GroupName="2" Text="失效" />--%></td>
                </tr>
               <tr>
                   <td style="width: 128px; text-align: right">
                       电子邮件：</td>
                   <td style="text-align: left" colspan="2">
                       <asp:TextBox ID="txt_uemail" runat="server"></asp:TextBox></td>
               </tr>
               <tr>
                   <td style="width: 128px; text-align: right">
                       部门：</td>
                   <td style="text-align: left" colspan="2">
                       <asp:DropDownList ID="ddl_udeptname" runat="server" Width="100px">
                       </asp:DropDownList></td>
               </tr>
               <tr>
                   <td style="width: 128px; text-align: right">
                       职位：</td>
                   <td style="text-align: left" colspan="2">
                       <asp:DropDownList ID="ddl_ujop" runat="server" Width="100px">
                       </asp:DropDownList></td>
               </tr>
               <tr>
                   <td style="width: 128px; text-align: right">
                       生日：</td>
                   <td style="text-align: left" colspan="2">
                       <cc1:gmdatepicker id="ubirthday" runat="server"></cc1:gmdatepicker>
                   </td>
               </tr>
               <tr>
                   <td style="width: 128px; text-align: right">
                       MSN/QQ账户</td>
                   <td colspan="2" style="text-align: left">
                       <asp:TextBox ID="txt_uqq" runat="server"></asp:TextBox></td>
               </tr>
                <tr>
                    <td colspan="3">
                        &nbsp;<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="修改" Width="50px" OnClientClick="return chk1()" style="color: #ffffff; background-color: #296cb3" Height="20px"  />
                   </td>
                </tr>
           </table>
                 <asp:HiddenField ID="HiddenField1" runat="server" />
                        <asp:HiddenField ID="HiddenField3" runat="server" />
           </div>
       </div>
       
       <table cellSpacing="0" cellPadding="0" border="0" align="center">
		    <tr>
		        <td style="background-color:White;padding-right: 10px; padding-left: 10px; padding-bottom: 10px; padding-top: 10px;">
		            <table cellSpacing="0" cellPadding="0" width="600" align="center" border="0" style="background-color:White;">
		                <tr>
		                    <td style="BORDER-RIGHT: #90b0de 1px solid; BORDER-TOP: #90b0de 1px solid; BORDER-LEFT: #90b0de 1px solid; BORDER-BOTTOM: #90b0de 1px solid; height: 213px; text-align: center;">
        
        <table border="0" width=900 align="center">
            <tr>
                <td style="border-top-width: 1px; font-weight: bold; border-left-width: 1px; border-left-color: #90b0de;
                    color: #004499; border-top-color: #90b0de; border-bottom: #90b0de 1px solid;
                    background-color: #ecf5ff; border-right-width: 1px; border-right-color: #90b0de; height: 29px;">
                    aaa</td>
            </tr>
               </table>
               <br />
       
        <table cellSpacing="0" cellPadding="0" align="center" border="0" style="width: 850px">
            <tr height="30">
                <td style="border-bottom: #90b0de 1px solid; background-color: #ecf5ff; font-weight: bold; color: #004499; border-top-width: 1px; border-left-width: 1px; border-left-color: #90b0de; border-top-color: #90b0de; border-right-width: 1px; border-right-color: #90b0de; text-align: left;">&nbsp;&nbsp;&nbsp;<a href="TAdCustomer.aspx">  <%=typename %> > (<span id='spanlab' runat="server" ></span>)</a></td>
            </tr>
        </table>
        <asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand1">
            <HeaderTemplate>
                <table style="font-size:13px" border="0" width="850" align="center">
                <tr>
                    <td align="center" colspan=13 style=" width:850; background-color: #ecf5ff">用户信息表</td>
                </tr>

                <tr > 
                    <td colspan=12 align="left" style="width:100%"><%--<a id="Insert"
                    href="javascript:void(0);"><span style="color: #0000ff; text-decoration: underline">
                        <img title="增加" alt="增加" src="../webdisk/images/ico/folder_new.gif" /></span></a>--%>
                        <input type="button" id='btn_Insert' value='增加' onclick="ddlbind();" style=' height:"20"; width:50; border-right-style: none; background-color: #296cb3; color: #ffffff; border-left-style: none;'/>
                        <%--<asp:button Width='40' id="btnAdd" runat="server"  Text="刷新" CausesValidation="false" BackColor="#296CB3" BorderStyle="None" ForeColor="White" ></asp:button>--%>
                        
                        <br /></td>
                       
                </tr>
                <tr style="background-color:#ecf5ff">
                    <td style="width:65; text-align:center">编号</td>
                    <td style="width:65; text-align:center">客户编号</td>
                    <td style="width:65; text-align:center">姓名</td>
                    <td style="width:65; text-align:center">性别</td>
                    <td style="width:65; text-align:center">电话</td>
                    <td style="width:70; text-align:center">手机</td>
                    <td style="width:65; text-align:center">传真</td>
                    <td style="width:65; text-align:center">电子邮件</td>
                    <td style="width:65; text-align:center">部门</td>
                    <td style="width:65; text-align:center">职位</td>
                    <td style="width:65; text-align:center">生日</td>
                    <td style="width:65; text-align:center">MSN/QQ账户</td>
                    <td style="width:65; text-align:center">选择</td>
                </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td style="width:65; text-align:center">
                        <a href='javascript:void(0);' onclick ='javascript:edit("<%#Eval("man_id") %>")'><%#Eval("man_id") %></a>
                    </td>
                    <td style="width:65; text-align:center">
                        <%#Eval("customer_id")%>
                    </td>
                    <td style="width:65; text-align:center">
                        <%#Eval("name")%>
                    </td>
                    <td style="width:65; text-align:center">
                        <%#Eval("sex")%>
                    </td>
                    
                    <td style="width:65; text-align:center">
                        <%#Eval("tel")%>
                    </td>
                    <td style="width:70; text-align:center">
                        <%#Eval("mobile") %>
                    </td>
                    <td style="width:65; text-align:center"><%#Eval("fax")%></td>
                    <td style="width:65; text-align:center"><%#Eval("email")%></td>
                    <td style="width:65; text-align:center"><%#Eval("dept_name")%></td>
                    <td style="width:65; text-align:center"><%#Eval("job")%></td>
                    <td style="width:65; text-align:center"><%#String.Format("{0:yyyy-MM-dd}", Eval("birthday")) %></td>
                    <td style="width:65; text-align:center"><%#Eval("im_account")%></td>
                    <td style="width:65; text-align:center">
                    <asp:linkbutton id="lbDelete" runat="server" CommandName="Del" CommandArgument='<%#Eval("man_id") %>'><img border="0" src="./images/del.gif" alt="删除" onClick="javascript:{return confirm('删除操作不可恢复，确认吗？');}"></asp:linkbutton>
                        <%--<asp:Button ID="Button1" runat="server" Text="删除" CommandName="Del" CommandArgument='<%#Eval("SalesCode") %>' />--%>
                        <%--<asp:Button ID="btn_update" runat="server" Text="修改" OnClientClick="$('#divUpdate').jqmShow();" CommandName="update" CommandArgument='<%#Eval("SalesCode") %>' />--%>
                        
                    </td>
                </tr>
            </ItemTemplate>
            <AlternatingItemTemplate>
                <tr bgcolor="#ecf5ff">
                    <td style="width:65; text-align:center">
                        <a href='javascript:void(0);' onclick ='javascript:edit("<%#Eval("man_id") %>")'><%#Eval("man_id") %></a>
                    </td>
                    <td style="width:65; text-align:center">
                        <%#Eval("customer_id")%>
                    </td>
                    <td style="width:65; text-align:center">
                        <%#Eval("name")%>
                    </td>
                    <td style="width:65; text-align:center">
                        <%#Eval("sex")%>
                    </td>
                    
                    <td style="width:65; text-align:center">
                        <%#Eval("tel")%>
                    </td>
                    <td style="width:70; text-align:center">
                        <%#Eval("mobile") %>
                    </td>
                    <td style="width:65; text-align:center"><%#Eval("fax")%></td>
                    <td style="width:65; text-align:center"><%#Eval("email")%></td>
                    <td style="width:65; text-align:center"><%#Eval("dept_name")%></td>
                    <td style="width:65; text-align:center"><%#Eval("job")%></td>
                    <td style="width:65; text-align:center"><%#String.Format("{0:yyyy-MM-dd}", Eval("birthday")) %></td>
                    <td style="width:65; text-align:center"><%#Eval("im_account")%></td>
                    <td style="width:65; text-align:center">
                    <asp:linkbutton id="lbDelete" runat="server" CommandName="Del" CommandArgument='<%#Eval("man_id") %>'><img border="0" src="./images/del.gif" alt="删除" onClick="javascript:{return confirm('删除操作不可恢复，确认吗？');}"></asp:linkbutton>
                        <%--<asp:Button ID="Button1" runat="server" Text="删除" CommandName="Del" CommandArgument='<%#Eval("SalesCode") %>' />--%>
                        <%--<asp:Button ID="btn_update" runat="server" Text="修改" OnClientClick="$('#divUpdate').jqmShow();" CommandName="update" CommandArgument='<%#Eval("SalesCode") %>' />--%>
                        
                    </td>
                </tr>
            </AlternatingItemTemplate>
            <FooterTemplate>
                <%--<tr>
                        <td colspan=9 style="width=100%"><%=pager%></td>
                    </tr>--%>
                </table>
            </FooterTemplate>
        </asp:Repeater>
        
        <br />
</td>
		                </tr>
		            </table>
		        </td>
		    </tr>
		</table>
    </div>
    </form>
</body>
</html>
